<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.net.http.HttpTokens</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.net.http.HttpTokens");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461">tango.net.http.HttpTokens</a></h1>
                
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a><br><br>
<b>Version:</b><br>
Initial release: April 2004<br><br>
<b>author:</b><br>Kris<br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>struct <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L38">HttpToken</a></span>
<script>explorer.outline.addDecl('HttpToken');</script>;</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Struct used to expose freachable HttpToken instances.</font><br><br>
</dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>class <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L60">HttpTokens</a></span>
<script>explorer.outline.addDecl('HttpTokens');</script> : IWritable;</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Maintains a set of HTTP tokens. These tokens include headers, query-
        parameters, and anything else vaguely related. Both input and output
        are supported, though a subclass may choose to expose as read-only.</font><br><br>
<font color="black">All tokens are mapped directly onto a buffer, so there is no memory
        allocation or copying involved. <br><br>        Note that this class does not support deleting tokens, per se. Instead
        it marks tokens as being 'unused' by setting content to null, avoiding 
        unwarranted reshaping of the token stack. The token stack is reused as
        time goes on, so there's only minor runtime overhead.<br><br></font><br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L83">this</a></span>
<script>explorer.outline.addDecl('this');</script>(char <span class="funcparam">separator</span>, bool <span class="funcparam">inclusive</span> = false);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Construct a set of tokens based upon the given delimiter, 
                and an indication of whether said delimiter should be
                considered part of the left side &#40;effectively the name&#41;.
        
                The latter is useful with headers, since the seperating
                ':' character should really be considered part of the 
                name for purposes of subsequent token matching.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L103">this</a></span>
<script>explorer.outline.addDecl('this');</script>(HttpTokens <span class="funcparam">source</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Clone a source set of HttpTokens</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L121">parse</a></span>
<script>explorer.outline.addDecl('parse');</script>(IBuffer <span class="funcparam">input</span>); [abstract]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Read all tokens. Everything is mapped rather than being 
                allocated &amp; copied</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L129">parse</a></span>
<script>explorer.outline.addDecl('parse');</script>(char[] <span class="funcparam">content</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Parse an input string.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>HttpTokens <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L141">reset</a></span>
<script>explorer.outline.addDecl('reset');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Reset this set of tokens.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L159">isParsed</a></span>
<script>explorer.outline.addDecl('isParsed');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Have tokens been parsed yet?</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L170">setParsed</a></span>
<script>explorer.outline.addDecl('setParsed');</script>(bool <span class="funcparam">parsed</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Indicate whether tokens have been parsed or not.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>char[] <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L182">get</a></span>
<script>explorer.outline.addDecl('get');</script>(char[] <span class="funcparam">name</span>, char[] <span class="funcparam">ret</span> = null);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the value of the provided header, or null if the
                header does not exist</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L202">getInt</a></span>
<script>explorer.outline.addDecl('getInt');</script>(char[] <span class="funcparam">name</span>, int <span class="funcparam">ret</span> = -1);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the integer value of the provided header, or the 
                provided default-vaule if the header does not exist</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>Time <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L219">getDate</a></span>
<script>explorer.outline.addDecl('getDate');</script>(char[] <span class="funcparam">name</span>, Time <span class="funcparam">date</span> = Time.epoch);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the date value of the provided header, or the 
                provided default-value if the header does not exist</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L235">opApply</a></span>
<script>explorer.outline.addDecl('opApply');</script>(int delegate(inout HttpToken) <span class="funcparam">dg</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Iterate over the set of tokens</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L256">write</a></span>
<script>explorer.outline.addDecl('write');</script>(IWriter <span class="funcparam">writer</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Output the token list to the provided writer</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L267">produce</a></span>
<script>explorer.outline.addDecl('produce');</script>(void delegate (void[]) <span class="funcparam">consume</span>, char[] <span class="funcparam">eol</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Output the token list to the provided consumer</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L285">handleMissingSeparator</a></span>
<script>explorer.outline.addDecl('handleMissingSeparator');</script>(char[] <span class="funcparam">s</span>, inout HttpToken <span class="funcparam">element</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">overridable method to handle the case where a token does
                not have a separator. Apparently, this can happen in HTTP 
                usage</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L296">split</a></span>
<script>explorer.outline.addDecl('split');</script>(Token <span class="funcparam">t</span>, inout HttpToken <span class="funcparam">element</span>); [private, final]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">split basic token into an HttpToken</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>FilteredTokens <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L326">createFilter</a></span>
<script>explorer.outline.addDecl('createFilter');</script>(char[] <span class="funcparam">match</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Create a filter for iterating over the tokens matching
                a particular name. 
        
</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>class <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L340">FilteredTokens</a></span>
<script>explorer.outline.addDecl('FilteredTokens');</script>; [private, static]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Implements a filter for iterating over tokens matching
                a particular name. We do it like this because there's no 
                means of passing additional information to an opApply&#40;&#41; 
                method.
        
</font><br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L352">this</a></span>
<script>explorer.outline.addDecl('this');</script>(HttpTokens <span class="funcparam">tokens</span>, char[] <span class="funcparam">match</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Construct this filter upon the given tokens, and
                        set the pattern to match against.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L364">opApply</a></span>
<script>explorer.outline.addDecl('opApply');</script>(int delegate(inout HttpToken) <span class="funcparam">dg</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Iterate over all tokens matching the given name</font><br><br></dd></dl></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L388">isSpace</a></span>
<script>explorer.outline.addDecl('isSpace');</script>(char <span class="funcparam">c</span>); [private]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Is the argument a whitespace character?</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>char[] <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L400">trim</a></span>
<script>explorer.outline.addDecl('trim');</script>(char[] <span class="funcparam">source</span>); [private]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Trim the provided string by stripping whitespace from 
                both ends. Returns a slice of the original content.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L429">setOutputBuffer</a></span>
<script>explorer.outline.addDecl('setOutputBuffer');</script>(IBuffer <span class="funcparam">output</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">these should be exposed carefully ******************</font><br><br>
<font color="black">Set the output buffer for adding tokens to. This is used
                by the various mutating classes.<br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>IBuffer <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L440">getOutputBuffer</a></span>
<script>explorer.outline.addDecl('getOutputBuffer');</script>(); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the buffer used for output.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>char[] <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L455">formatTokens</a></span>
<script>explorer.outline.addDecl('formatTokens');</script>(IBuffer <span class="funcparam">dst</span>, char[] <span class="funcparam">delim</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return a char[] representing the output. An empty array
                is returned if output was not configured. This perhaps
                could just return our 'output' buffer content, but that
                would not reflect deletes, or seperators. Better to do 
                it like this instead, for a small cost.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L482">add</a></span>
<script>explorer.outline.addDecl('add');</script>(char[] <span class="funcparam">name</span>, void delegate (IBuffer) <span class="funcparam">dg</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Add a token with the given name. The content is provided
                via the specified delegate. We stuff this name &amp; content
                into the output buffer, and map a new Token onto the
                appropriate buffer slice.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L507">add</a></span>
<script>explorer.outline.addDecl('add');</script>(char[] <span class="funcparam">name</span>, char[] <span class="funcparam">value</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Add a simple name/value pair to the output</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L523">addInt</a></span>
<script>explorer.outline.addDecl('addInt');</script>(char[] <span class="funcparam">name</span>, int <span class="funcparam">value</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Add a name/integer pair to the output</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L536">addDate</a></span>
<script>explorer.outline.addDecl('addDate');</script>(char[] <span class="funcparam">name</span>, Time <span class="funcparam">value</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Add a name/date&#40;long&#41; pair to the output
                
</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/http/HttpTokens.d?rev=3461#L550">remove</a></span>
<script>explorer.outline.addDecl('remove');</script>(char[] <span class="funcparam">name</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">remove a token from our list. Returns false if the named
               token is not found.
                
</font><br><br></dd></dl></dd></dl></td></tr>
                <tr><td id="docfooter">
                        Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Jun  8 17:12:55 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>